#if !CMapDesign_H
#define CMapDesign_H 1

class ToaDo{
public:
	ToaDo()
	{
		_x=0;
		_y=0;
		_z=0;
	}
	int _x;
	int _y;
	int _z;
};
class Luoi{
public:
	Luoi()
	{
		_num_x=0;
		_num_y=0;
		_w=0;
		_h=0;
		_type=0;
		_idLuoi=0;
	}
	int _idLuoi;
	int _num_x;
	int _num_y;
	int _w;
	int _h;
	int _type;
};
class Lop{
public:
	Lop()
	{
		_id=0;
		_soLuong=0;
		_state=0;
	}
	int _id;
	int _soLuong;
	int _state;
	ToaDo _toaDo;//=new ToaDo();
	Luoi _luoi;//=new Luoi();

};
class Truong{
public:
	Truong()
	{
		_id=0;
		_soLuong=0;
		_state=0;
	}
	int _id;
	int _soLuong;
	int _state;
};
class ChiTiet{
public:
	ChiTiet()
	{
		_idTruong=0;
		_idLop=0;
		_state=0;
		_soLuong=0;
	}
	int _soLuong;
	int _state;
	int _idTruong;
	int _idLop;
	ToaDo _toaDo;//=new ToaDo();
	Luoi _luoi;
};
class CMapDesign{
public:
	int _soLuongChiTiet;
	int _soLuongTruong;
	int _soLuongLop;
	Lop *_arrLop;
	Truong *_arrTruong;
	ChiTiet *_arrChiTiet;
	char _header[6];
	int _vesion;
	int _sub_version;
	char _headerMap_B[4];
	char _headerMap_E[4];
	int _dg_w;
	int _dg_h;
	int _z;

	char _headerFDIF_B[4];
	char _headerFDIF_E[4];

	char _headerCVAS_B[4];
	char _headerCVAS_E[4];

	char _headerITEM_B[4];
	char _headerITEM_E[4];

	char *_buffer;
	char *_buffer_temp;

	void SetCharAtHeader(char *buffer,int offset,char *header);//header of file
	char *GetCharAtHeader(char *buffer,int offset);

	void SetByteAt(char *buffer,int offset,int value);
	char GetByteAt(char *buffer,int offset);

	void SetIntAt16(char *buffer,int offset,int value);
	int GetIntAt16(char *buffer,int offset);

	void SetIntAt32(char *buffer,int offset,int value);
	int GetIntAt32(char *buffer,int offset);

	void SetCharAtBeginEnd(char *buffer,int offset,char *chuck);
	char *GetCharAtB_E(char *buffer,int offset);

	void ReadFile();
	void ReadFile(ResourceInputStream *is);
	void ReadFileTemp(ResourceInputStream *is);
	void Output();
	void OutputFile();
	void StateTruong();
	void Render();
	void Update();
	bool CheckText(char *str);
	ToaDo Positon(int idOLuoi);
};
#endif